home *** CD-ROM | disk | FTP | other *** search
/ Programming Sound Cards / Programming Sound Cards.iso / sound_24 / digitize.doc < prev    next >
Text File  |  1995-01-01  |  7KB  |  216 lines

  1.  
  2.  
  3.  
  4.  
  5.                            DIGIKIT, v1.1
  6.                          by Andrew Neitzke
  7.  
  8.  
  9.         DIGIKIT is a library of routines I put together about a year ago
  10.    for playback of digitized sounds through a Sound Blaster or
  11.    compatible card.  Over time, I found that I was going through the
  12.    hassle of mailing these routines to people every time someone needed
  13.    info on SB programming.  Eventually, I decided that I would just put
  14.    them all together and release them, so now, here they are.
  15.  
  16.         I can't guarantee that DIGIKIT will work for you.  All I can
  17.    guarantee is that it works for me.  In no event, furthermore, will I
  18.    be liable for any damage it may cause you, your computer system, your
  19.    psychological health or your cat.  Personally, I can't imagine how it
  20.    could hurt ANYTHING, but I see these disclaimers everywhere and I
  21.    figured I should probably have one.
  22.  
  23.         This library is copyrighted and all rights are reserved except
  24.    those expressly granted here.  Now, having said that, you may use it
  25.    without restriction in your own programs and may distribute it to
  26.    anyone you like as far as I'm concerned. However, if you use DIGIKIT
  27.    in a program which you release, I would appreciate some sort of
  28.    footnote in the docs indicating that you used it.
  29.  
  30.         Should you feel the overpowering urge to support me, you can
  31.    send a few bucks (or even just a supportive note) to:
  32.  
  33.                           Andrew Neitzke
  34.                           Oak Hill Court S-220
  35.                           Narberth, PA 19072-1008
  36.  
  37.         Before using DIGIKIT, you should run DIGITEST.EXE and be sure
  38.    that it works properly.
  39.  
  40.  
  41.  
  42.  
  43.                          TECHNICAL INFORMATION
  44.                          ---------------------
  45.  
  46.         DIGIKIT operates by loading the Sound Blaster voice driver
  47.    CT-VOICE.DRV (as far as I know, this file is included with all Sound
  48.    Blaster boards; however, I am uncertain of the legality of
  49.    distributing it) and then making calls to it.
  50.  
  51.         ** CT-VOICE.DRV IS REQUIRED FOR DIGIKIT TO OPERATE CORRECTLY **
  52.  
  53.         If you want to use these functions and variables in your
  54.    program, put DIGITIZE.H in your include directory and place the
  55.    statement:
  56.  
  57.         #include "digitize.h"
  58.  
  59.    at the top of all source files which use them.  Then link DIGIT?.LIB
  60.    (where ? represents your memory model; for example, in the large
  61.    memory model, you would use DIGITL.LIB) with your object code, and
  62.    call the functions as you would any other.  That's all there is to it.
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.                              FUNCTIONS
  70.                              ---------
  71.  
  72.  
  73. void sbsetup(int irqline, int ioaddr);
  74.  
  75.    This function handles all the setup (including loading) for the Sound
  76.    Blaster driver, CT-VOICE.DRV.  Its two parameters are the card's IRQ
  77.    line (default 7) and I/O port address (default 220h).
  78.  
  79.     void sbdrvload();
  80.  
  81.        This function loads the SB driver (unnecessary if you use sbsetup())
  82.  
  83.     void sbinit(int irqline, int ioaddr);
  84.  
  85.        This function inits the SB driver (unnecessary if you use sbsetup())
  86.        Its two parameters are the card's IRQ line (default 7) and I/O port
  87.        address (default 220h).
  88.  
  89.  
  90. void sbdeinit();
  91.  
  92.    This function "de-initializes" the SB driver and frees its memory.
  93.  
  94.  
  95. void sbplay(char far *data, int headerlen);
  96.  
  97.    This function begins play of a sound.  The far pointer "data" should
  98.    point to a block of sound data in the VOC file format.  This data is
  99.    required to remain valid until the sound is finished playing, so be
  100.    sure not to free the pointer until you can be sure it is done (you
  101.    can find out by checking sbstatusword).  The integer "headerlen" is
  102.    the length of the header to be skipped; for a VOC file it should be
  103.    0x1A or 26.  For data you have recorded with sbgetvoice(), there is
  104.    no header, so headerlen should be set to zero.
  105.  
  106.    Note that no sound will be heard if the speaker is not on.
  107.  
  108.    Control is immediately returned to the calling program.
  109.  
  110.  
  111. void sbwaitsound();
  112.  
  113.    This function will pause program execution until the currently
  114.    playing/recording sound is finished, or return immediately if no
  115.    voice process is active.
  116.  
  117.  
  118. void sbtermsound();
  119.  
  120.    This function immediately terminates any sound playing/recording and
  121.    returns control to your program.
  122.  
  123.  
  124. void sbpausesound();
  125.  
  126.    This function pauses the currently playing sound.
  127.  
  128.  
  129. void sbcontsound();
  130.  
  131.    This function continues a previously paused sound.
  132.  
  133.  
  134. void sbgetsound(int samprate, int bufsize, char far *buf);
  135.  
  136.    This function begins recording of a sound.  The far pointer "buf"
  137.    should point to a pre-allocated block of size bufsize.  The integer
  138.    "samprate" should be the sampling rate in Hertz, from 4000 to 12000.
  139.  
  140.    If the speaker is on during recording, the sound recorded will be
  141.    simultaneously output to the speaker.
  142.  
  143.    Control is immediately returned to the calling program.
  144.  
  145.  
  146. void sbspeaker(char mode);
  147.  
  148.    This function turns the speaker on or off (1 for ON, 0 for OFF).
  149.    sbinit() turns it on by default, but you might want to turn it off
  150.    during voice input (see above).
  151.  
  152.  
  153. int sbgetversionnumber();
  154.  
  155.    This function returns the version number of the SB driver.  The major
  156.    version number is held in the MSB, the minor in the LSB.
  157.  
  158.  
  159.  
  160.  
  161.                             VARIABLES
  162.                             ---------
  163.  
  164.  
  165.    char sberrorcond
  166.  
  167.      This variable will be set to one of these values (defined in
  168.      digitize.h) when an error occurs in one of the SB functions:
  169.  
  170.         CARDFAILURE      SB card failure.  May indicate card not present
  171.                          in system.
  172.  
  173.         IOFAILURE        I/O failure.  May indicate that the I/O address
  174.                          is incorrect.
  175.  
  176.         DMAFAILURE       DMA failure.  May indicate that the IRQ line is
  177.                          incorrect.
  178.  
  179.         FILEERROR        Indicates some sort of file access error,
  180.                          probably "file not found".
  181.  
  182.         NOTREADY         Indicates that a function which requires the
  183.                          Sound Blaster driver was called without first
  184.                          initializing it.
  185.  
  186.         NOMEMORY         Indicates that there was insufficient memory to
  187.                          load the driver.
  188.  
  189.  
  190.    char sbinitialized
  191.  
  192.      Holds 0 if the Sound Blaster driver has not yet been initialized, 1
  193.      if it has.
  194.  
  195.    volatile unsigned int sbstatusword
  196.  
  197.      This value is set directly by the SB driver.  It holds FFFF while
  198.      voice input/output is in progress; otherwise it holds 0000.
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206. DIGIKIT has been tested with Turbo C++ 1.01 on my Gateway 2000 386/25.
  207.  
  208. Problems?  Comments?  In addition to the address given above, you can
  209. reach me at:
  210.  
  211. ILink        SoundBoards "ANDREW NEITZKE"
  212. RIME ->????  Common      "ANDREW NEITZKE"
  213. Prodigy                  VTBH81A
  214.  
  215. Good luck!
  216.